Beispiel #1
0
 public static function get_authors($arr = array())
 {
     global $config_q;
     if (isset($arr["current_page"])) {
         $limit_start = ($arr["current_page"] - 1) * $config_q["quotes_on_page"];
         $limit = "LIMIT " . ($arr["current_page"] - 1) * $config_q["quotes_on_page"] . "," . $config_q["quotes_on_page"];
     }
     if (isset($arr["char"])) {
         $s_where = "WHERE author_lastname_" . $config_q["locale"] . " LIKE '" . $arr["char"] . "%' ";
     }
     if (strlen($s_where) > 0) {
         $s_where .= "\n\t\t\t\tAND\n\t\t\t\t\t" . $config_q["db"]["prefix"] . "quote_authors.id = " . $config_q["db"]["prefix"] . "quotes.author_id\n\t\t\t\tAND\n\t\t\t\t\tactive = 1\n\t\t\t\tAND\n\t\t\t\t\tlang = '" . $config_q["locale"] . "' ";
     } else {
         $s_where .= "\n\t\t\t\tWHERE\n\t\t\t\t\t" . $config_q["db"]["prefix"] . "quote_authors.id = " . $config_q["db"]["prefix"] . "quotes.author_id\n\t\t\t\tAND\n\t\t\t\t\tactive = 1\n\t\t\t\tAND\n\t\t\t\t\tlang = '" . $config_q["locale"] . "' ";
     }
     $a_out = array();
     $q = "\n\t\t\tSELECT\n\t\t\t\tDISTINCT\n\t\t\t\t" . $config_q["db"]["prefix"] . "quote_authors.id as author_id,\n\t\t\t\tauthor_name_freeform_" . $config_q["locale"] . ",\n\t\t\t\tauthor_firstname_" . $config_q["locale"] . ",\n\t\t\t\tauthor_midname_" . $config_q["locale"] . ",\n\t\t\t\tauthor_lastname_" . $config_q["locale"] . ",\n\t\t\t\tauthor_born_death_circa,\n\t\t\t\tauthor_born,\n\t\t\t\tauthor_death,\n\t\t\t\tauthor_profession_" . $config_q["locale"] . ",\n\t\t\t\tauthor_wiki_url_" . $config_q["locale"] . ",\n\t\t\t\turl_friendly_author_name_" . $config_q["locale"] . "\n\t\t\tFROM\n\t\t\t\t" . $config_q["db"]["prefix"] . "quote_authors,\n\t\t\t\t" . $config_q["db"]["prefix"] . "quotes\n\t\t\t{$s_where}\n\t\t\torder by\n\t\t\t\tauthor_lastname_" . $config_q["locale"] . " asc\n\t\t\t{$limit};\n\t\t";
     $r = q($q);
     $a_out = array();
     while ($row = mysqli_fetch_array($r, MYSQL_ASSOC)) {
         $row = author::parse_author_born_death($row);
         $row = author::parse_author_name($row);
         $row = author::parse_url_friendly_author_name($row);
         $a_out[] = $row;
     }
     return $a_out;
 }
Beispiel #2
0
 public static function get_from_waitinglist()
 {
     global $user, $config_q, $table_prefix;
     $q = "\n\t\t\tSELECT\n\t\t\t\t" . $config_q["db"]["prefix"] . "quotes_waiting_approval.id AS waiting_quote_id,\n\t\t\t\t" . $config_q["db"]["prefix"] . "quotes_waiting_approval.author_id AS author_id,\n\n\t\t\t\t" . $config_q["db"]["prefix"] . "quote_authors.author_name_freeform_et AS author_name_freeform_et,\n\t\t\t\t" . $config_q["db"]["prefix"] . "quote_authors.author_lastname_et AS author_lastname_et,\n\t\t\t\t" . $config_q["db"]["prefix"] . "quote_authors.author_midname_et AS author_midname_et,\n\t\t\t\t" . $config_q["db"]["prefix"] . "quote_authors.author_firstname_et AS author_firstname_et,\n\t\t\t\t" . $config_q["db"]["prefix"] . "quote_authors.url_friendly_author_name_" . $config_q["locale"] . ",\n\n\t\t\t\t" . $config_q["db"]["prefix"] . "quotes_waiting_approval.author_name AS waiting_author_name,\n\t\t\t\t" . $config_q["db"]["prefix"] . "quotes_waiting_approval.author_profession_et AS waiting_author_profession_et,\n\n\t\t\t\t" . $config_q["db"]["prefix"] . "quotes_waiting_approval.author_born AS waiting_author_born,\n\t\t\t\t" . $config_q["db"]["prefix"] . "quotes_waiting_approval.author_death AS waiting_author_death,\n\t\t\t\t" . $config_q["db"]["prefix"] . "quotes_waiting_approval.quote AS quote,\n\t\t\t\t" . $config_q["db"]["prefix"] . "categories.name_" . $config_q["locale"] . " as category,\n\t\t\t\t" . $config_q["db"]["prefix"] . "quotes_waiting_approval.tag AS tag,\n\t\t\t\t" . $config_q["db"]["prefix"] . "quotes_waiting_approval.source_title AS waiting_source_title,\n\t\t\t\t" . $config_q["db"]["prefix"] . "quotes_waiting_approval.source_year_start AS waiting_source_year_start,\n\t\t\t\t" . $config_q["db"]["prefix"] . "quotes_waiting_approval.created_by AS waiting_created_by,\n\t\t\t\t" . $config_q["db"]["prefix"] . "quotes_waiting_approval.date_inserted AS waiting_date_inserted,\n\t\t\t\t" . USERS_TABLE . ".username AS username\n\t\t\tFROM\n\t\t\t(\n\t\t\t\t" . $config_q["db"]["prefix"] . "quotes_waiting_approval,\n\t\t\t\t" . USERS_TABLE . ",\n\t\t\t\t" . $config_q["db"]["prefix"] . "categories\n\t\t\t)\n\t\t\tLEFT JOIN\n\t\t\t\t" . $config_q["db"]["prefix"] . "quote_authors\n\t\t\tON\n\t\t\t\t" . $config_q["db"]["prefix"] . "quotes_waiting_approval.author_id = " . $config_q["db"]["prefix"] . "_quote_authors.id\n\t\t\tWHERE\n\t\t\t\t" . USERS_TABLE . ".user_id = " . $config_q["db"]["prefix"] . "quotes_waiting_approval.created_by\n\t\t\t\tAND\n\t\t\t\t" . $config_q["db"]["prefix"] . "quotes_waiting_approval.author_id != 0\n\t\t\t\tAND\n\t\t\t\tstatus = 0\n\t\t\t\tAND\n\t\t\t\t" . $config_q["db"]["prefix"] . "categories.id = " . $config_q["db"]["prefix"] . "quotes_waiting_approval.category\n\t\t\tORDER BY \n\t\t\t\tdate_inserted\n\t\t\tASC\n\t\t;";
     $r = q($q);
     $a_out = array();
     while ($row = mysqli_fetch_array($r, MYSQL_ASSOC)) {
         $row = quote::parse_tags($row);
         $row = author::parse_author_name($row);
         $row = author::parse_author_born_death($row);
         $row = author::parse_author_profession($row);
         $row = author::parse_url_friendly_author_name($row);
         $a_out[] = $row;
     }
     //$a_out = $this->get_author_img_data2($a_out);
     $a_out = quote::parse_author_photos($a_out);
     return $a_out;
 }