Code Duplication    Length = 33-33 lines in 2 locations

include/functions.php 2 locations

@@ 78-110 (lines=33) @@
75
 * @param $orderby
76
 * @return string
77
 */
78
function convertorderbyin($orderby)
79
{
80
    $orderby = (isset($orderby) && ('' != trim($orderby))) ? trim($orderby) : '';
81
    switch ($orderby) {
82
        case 'titleA':
83
            $orderby = 'title ASC';
84
            break;
85
        case 'hitsA':
86
            $orderby = 'hits ASC';
87
            break;
88
        case 'ratingA':
89
            $orderby = 'rating ASC';
90
            break;
91
        case 'dateA':
92
            $orderby = 'date ASC';
93
            break;
94
        case 'titleD':
95
            $orderby = 'title DESC';
96
            break;
97
        case 'hitsD':
98
            $orderby = 'hits DESC';
99
            break;
100
        case 'ratingD':
101
            $orderby = 'rating DESC';
102
            break;
103
        case 'dateD':
104
        default:
105
            $orderby = 'date DESC';
106
            break;
107
    }
108
109
    return $orderby;
110
}
111
112
/**
113
 * @param $orderby
@@ 154-186 (lines=33) @@
151
 * @param $orderby
152
 * @return string
153
 */
154
function convertorderbyout($orderby)
155
{
156
    $orderby = (isset($orderby) && ('' != trim($orderby))) ? trim($orderby) : '';
157
    switch ($orderby) {
158
        case 'title ASC':
159
            $orderby = 'titleA';
160
            break;
161
        case 'hits ASC':
162
            $orderby = 'hitsA';
163
            break;
164
        case 'rating ASC':
165
            $orderby = 'ratingA';
166
            break;
167
        case 'date ASC':
168
            $orderby = 'dateA';
169
            break;
170
        case 'title DESC':
171
            $orderby = 'titleD';
172
            break;
173
        case 'hits DESC':
174
            $orderby = 'hitsD';
175
            break;
176
        case 'rating DESC':
177
            $orderby = 'ratingD';
178
            break;
179
        case 'date DESC':
180
        default:
181
            $orderby = 'dateD';
182
            break;
183
    }
184
185
    return $orderby;
186
}
187
188
/**
189
 * Update rating data for a link in dB link table to keep in sync